<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>javascript</title>
</head>
<style>
	#tid{
		display:none;
	}
	#up{
		cursor: pointer;
	}
	input[type=submit]{
		background: #fff;
		border:1px solid #ccc;
	}
</style>
<body>
	<form action="">
		<p>上传文件：</p>
		<p><input type="file" id='tid'></p>
		<p><img src="up.jpg" alt="" id="up"></p>
		<p id="pid"></p>
		<p><input type="submit" value="ok"></p>
	</form>
</body>
<script>
	//onchange当input中value改变时，将值显示出来
	tidobj=document.getElementById('tid');
	upobj=document.getElementById('up');
	pidobj=document.getElementById('pid');

	upobj.onclick=function(){
		tidobj.click();
	}
	tidobj.onchange=function(){
		//alert(this.value);
		pidobj.innerHTML=this.value;
	}

</script>
</html>